<?php

namespace Action\User\Preferences;

class ChangeName extends \Library\Action\UserAction 
	implements \Library\Action\AjaxAction {

	public function execute() {
		parent::execute();
		
		$first_name = trim($this->getParam( 'first_name' ));
		$last_name = trim($this->getParam( 'last_name' ));
		
		_c( 'FirstName', $first_name );
		_c( 'LastName', $last_name );
	
		$user = _u();
		$user->setName( $first_name, $last_name );
		
		\Library\User\Session::getSession()->setUser( $user );

		return true;
	}
}
